<?php
//ini_set('display_errors',1);
header("Content-Type:text/html;charset=utf-8");
ini_set("soap.wsdl_cache_enabled", "0");
// disabling WSDL cache

include_once dirname(dirname(dirname(__FILE__))) . '/mgtv_init.php';
$wsdl = 'http://1.25.202.123/nn_mgtvbk/mgtv_v2/sp_nmgu/soap/nmgu_notify.php?wsdl';
$client = new SOAPClient($wsdl, array('trace' => 1));
//echo ('<pre>');
//var_dump ( $client->__getFunctions () );
//echo ('</pre>');
//echo ("SOAP服务器提供的Type:");
//echo ('<pre>');
//var_dump ( $client->__getTypes () );
//echo ('</pre>');
//exit;

$db = nn_get_db(NL_DB_WRITE);
$db -> open();
$sql = "select * from nns_mgtvbk_c2_log where nns_org_id='sp_nmgu'  and ISNULL(nns_notify_result) limit 10";

$list = nl_db_get_all($sql, $db);

foreach ($list as $key => $value) {
	$CMSID = '2';
	$SOPID = 'hntv';
	$CorrelateID = $value['nns_id'];//'51f798438156e9a1e111f821c8a33a87';
	$CmdResult = 0;
	$ErrorDescription = '0';
	$ResultFileURL = '';
	try {
		$ret = $client -> ContentPublishResult($CMSID, $SOPID, $CorrelateID, $CmdResult, $ErrorDescription, $ResultFileURL);
	} catch(Exception $e) {
		echo '<pre>';
		echo $client -> __getLastRequest(), PHP_EOL;
		echo $client -> __getLastRequestHeaders(), PHP_EOL;
		echo $client -> __getLastResponse(), PHP_EOL;
		echo $client -> __getLastResponseHeaders(), PHP_EOL;
		echo $e -> getMessage();
		die ;

	}
}
